/*
输出需要
 */
package number_convert

import (
	"fmt"
)


// byte 转 16 进制字符串
func ByToHex(ori byte) string {
	return fmt.Sprintf("%02x" , ori)
}

// 16 进制字符串转 byte ...很笨拙的办法...
func HexToBy(hex string) byte {
	re := byte(0)
	if t := hex[0] - '0'; t < 10 {
		re += t * 16
	} else {
		re += ((hex[0] - 'a') + 10) * 16
	}
	if t := hex[1] - '0'; t < 10 {
		re += t
	} else {
		re += (hex[1] - 'a') + 10
	}
	return re
}

// 16 进制字符串数组转 byte数组
func GetBytes(p *[][]string) [][]byte {
	bp := make([][]byte, 4)
	for j := 0; j < 4; j++ {
		bp[j] = make([]byte, 4)
	}
	for i := 0; i < 4; i++ {
		for j := 0; j < 4; j++ {
			bp[i][j] = HexToBy((*p)[i][j])
		}
	}
	return bp
}